package top.healthylife.gateway.platform.br.api.api.basicdata;


import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.br.api.utils.GetmeltingTokenUtils;
import top.healthylife.gateway.platform.br.dto.basicdata.drivinglicenseinformation.req.BrReqDrivingLicenseInformationDto;
import top.healthylife.gateway.platform.br.dto.basicdata.drivinglicenseinformation.res.BrResDrivingLicenseInformationDto;

/**
 * @author cl
 * @version 1.0
 * @date 2020/4/22 16:58
 */
@Slf4j
@Service
@ApiServiceExplain( docUrl="https://account-self.100credit.com/", price = 20,apiName = "行驶证基本信息验证", info = "验证个人信息与车辆行驶证记录是否一致。如果一致则返回车辆状态。")
public class DrivingLicenseInformationApi implements ParentFace<BrReqDrivingLicenseInformationDto, BrResDrivingLicenseInformationDto> {
    /**
     * 接口唯一标识
     */
    static final String APIIDENTIFICATION = "VehLicCheck";

    /**
     * 接口版本号
     */
    static final String VESION = null;

    @Override
    public BrResDrivingLicenseInformationDto execute(BrReqDrivingLicenseInformationDto brDemoApi){
        //访问百融获取数据
        String apiData = GetmeltingTokenUtils.getApiData(APIIDENTIFICATION, VESION
                , BeanUtil.beanToMap(brDemoApi), GetmeltingTokenUtils.systemConfigInfo(brDemoApi));
        return JSON.parseObject(apiData, BrResDrivingLicenseInformationDto.class);
    }
}
